UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qHMrtVIS+DT6AwDIwuvgYTUSZ53QATj8LjAiAztTNzA=' 
WHERE 
  key_id = '61ba9b8d388e33c2227f3bee996eab6023a03853c1bfd6ff96a4aa68c46deb8d' 
  AND (
    token = 'qHMrtVIS+DT6AwDIwuvgYTUSZ53QATj8LjAiAztTNzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029