UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MZrRzAmlFTib2AN2bexXZ0GvRPcXRJ4+cZEp0apzFcI=' 
WHERE 
  key_id = '82865efddaa95a84fdef5969d97656a37c78da1262baf2f318ea357788ce7a33' 
  AND (
    token = 'MZrRzAmlFTib2AN2bexXZ0GvRPcXRJ4+cZEp0apzFcI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024