UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't5GtLYWh3ECzV9LpnkBBcXnDdcrcW77yw+Urj1vvZwU=' 
WHERE 
  key_id = '66d1c81fe99217c5660a3b38fc38bc025b53c18670bf4276540590aadec085f7' 
  AND (
    token = 't5GtLYWh3ECzV9LpnkBBcXnDdcrcW77yw+Urj1vvZwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030