UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RdXAlI9sckzay3GVJWVO3lMpLnM47l361OmImGWaocY=' 
WHERE 
  key_id = '7da1edfa655ef19789dd5b1235f1492a57ebda7078923dfee8368ab65fcf8521' 
  AND (
    token = 'RdXAlI9sckzay3GVJWVO3lMpLnM47l361OmImGWaocY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017