UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6X7NBql6DV8fQ+8zoetWV4cinWTYJhqXx8uOvdbm0a4=' 
WHERE 
  key_id = '47171e3e0efc6c953d964a4e1d328e30b6057b3c4226b5c3514c5e085994f6ae' 
  AND (
    token = '6X7NBql6DV8fQ+8zoetWV4cinWTYJhqXx8uOvdbm0a4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030