UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P5K4K0KMEdxWbEzOSzVb/KiTBrJ/t719GvYJWiSWHjY=' 
WHERE 
  key_id = '80edd3ba9347145ab101048492218e955441984dccf09975f04569bb53587037' 
  AND (
    token = 'P5K4K0KMEdxWbEzOSzVb/KiTBrJ/t719GvYJWiSWHjY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035