UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8DNZdxsVUCXnei9Szz2NbIBd/566SjP7p4BvbXM8sO8=' 
WHERE 
  key_id = '4b495df5b277f46e735b942483fa6fe10e71d389c95042576afa5ba10187b0dd' 
  AND (
    token = '8DNZdxsVUCXnei9Szz2NbIBd/566SjP7p4BvbXM8sO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023