UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UjzYrYdSDqJ01RHT0zD9aRz8IZaQD4t7EL5dpxEZl38=' 
WHERE 
  key_id = 'f3b99aef98fc37bb661dde0eb90e218749bf26397a919e94e6165f73835eca13' 
  AND (
    token = 'UjzYrYdSDqJ01RHT0zD9aRz8IZaQD4t7EL5dpxEZl38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041