UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VYOfr9vkbuGKnU/xzqgLXdkXSDtCzGDB5Dt/5+gzafM=' 
WHERE 
  key_id = '2322eac0739b1862cf26bea47725d50e1be5b9af006819d041381815764315cb' 
  AND (
    token = 'VYOfr9vkbuGKnU/xzqgLXdkXSDtCzGDB5Dt/5+gzafM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030