UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CxIHvZlh/222k3Qad5z026LtRk7WXEtCUfJy99OwgZs=' 
WHERE 
  key_id = 'deb817817b95a43ff509aa0e9bb89325c790be7f312e3a3a61bb2ffce86c6a1b' 
  AND (
    token = 'CxIHvZlh/222k3Qad5z026LtRk7WXEtCUfJy99OwgZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016