UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+vuztFRBo7jbLez75zExavmX3raIkr5APndySugUc94=' 
WHERE 
  key_id = '645ae3da8d201931a4f97575685e5c2f543911e1872348db37affbed2e720c18' 
  AND (
    token = '+vuztFRBo7jbLez75zExavmX3raIkr5APndySugUc94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032