UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7guY0BEKrjMkSsOK17fqGGHFflC7OXcWNF0DVgzWoo0=' 
WHERE 
  key_id = '14b89bfc3cb8b71fc8dfb766b4cb638cfe00e2e0f9a0b38baeb371d0409f4474' 
  AND (
    token = '7guY0BEKrjMkSsOK17fqGGHFflC7OXcWNF0DVgzWoo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028