UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VF83uKXima90B3ts3zcEMmHyuJaE0D+219eeWMch7J8=' 
WHERE 
  key_id = '1c4114aeb4a8320dab5fff9f05e85054312b1efbae5263409c4b7bd831b3309c' 
  AND (
    token = 'VF83uKXima90B3ts3zcEMmHyuJaE0D+219eeWMch7J8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015