UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't27uAV3mMl+GFH5hrqnp/883IrFYuT39SlEmNx5xM80=' 
WHERE 
  key_id = '8dff4a4434c6732ef313fd30c0742392b843c1301835541af1619da1d83017c3' 
  AND (
    token = 't27uAV3mMl+GFH5hrqnp/883IrFYuT39SlEmNx5xM80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050