UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eCHz3jAJHBsSWZpbPvuYGKuPgcB/YW0pUhkAvpH8pgI=' 
WHERE 
  key_id = '33e5a28cc8d8f1c0adea5147d6195c1e1d0e1f12395024829d7d06299cc43aa4' 
  AND (
    token = 'eCHz3jAJHBsSWZpbPvuYGKuPgcB/YW0pUhkAvpH8pgI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033