UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qIh8vggYAxoMq+akP1QCdzDznmMPTMlHen7NV+w51fg=' 
WHERE 
  key_id = '4c1cd8c7174e66ffac025be15defc5900454c36cc1cc584cac491d67806d10f6' 
  AND (
    token = 'qIh8vggYAxoMq+akP1QCdzDznmMPTMlHen7NV+w51fg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021