UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kmLJtUsCJwE+3y1fFCmPQzSBHzs7oCoSSJY0G2DIDXw=' 
WHERE 
  key_id = '0d6911a66370e316961204466011da2a76e39c46bc5def68050f192403a1a7fb' 
  AND (
    token = 'kmLJtUsCJwE+3y1fFCmPQzSBHzs7oCoSSJY0G2DIDXw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028