UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6i5xORCMWHvvRdCqPimPjtourpE4MmNcVL13gu7n1+Y=' 
WHERE 
  key_id = '7bc540fa5d53364cd7f847d365d494201149436c1c1198f8046c93f8b948d524' 
  AND (
    token = '6i5xORCMWHvvRdCqPimPjtourpE4MmNcVL13gu7n1+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023