UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'erDsPOf6/YDewLt1Pg88MN64O+52dps+GhOAaGSW5VM=' 
WHERE 
  key_id = '49b1c10616e6c9a9dd4992519ef08f82e163c4144a12dbdad012f8aa304bd5d6' 
  AND (
    token = 'erDsPOf6/YDewLt1Pg88MN64O+52dps+GhOAaGSW5VM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042