UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tCnV4d2TmOZ+MviXrdQmhN8CAtfHc2Ag8wdW0gOOJzQ=' 
WHERE 
  key_id = 'c41228ea13149a6df2482503b3b431701b5c51b96ba46cd8e59e457f4350755b' 
  AND (
    token = 'tCnV4d2TmOZ+MviXrdQmhN8CAtfHc2Ag8wdW0gOOJzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054