UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4+uZzayzRmZOHVoxEXMeG/D3xHwmYeYwda3ujglw0l8=' 
WHERE 
  key_id = 'f209f4514d20ce6a96a7ae241d89e28646908c63241fd87f913bd62ca92b44f0' 
  AND (
    token = '4+uZzayzRmZOHVoxEXMeG/D3xHwmYeYwda3ujglw0l8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028