UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BjMO0BiydGSu4kl654uKreZmkxl4wnqYkPwBtEvP6ew=' 
WHERE 
  key_id = '9bc364e90a4cb767801f699093e92c3d3ae53970d616ea98b7f1aa6d03b59d80' 
  AND (
    token = 'BjMO0BiydGSu4kl654uKreZmkxl4wnqYkPwBtEvP6ew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025