UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ZYOZJJ4Pf+itzVa+PivIzaXM/XXvccQtIbilCzI8bU=' 
WHERE 
  key_id = '0fc6f2ee79d9fa0534492857d30a60a69da19307486b117d0e3a03e538cb00d5' 
  AND (
    token = '5ZYOZJJ4Pf+itzVa+PivIzaXM/XXvccQtIbilCzI8bU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047