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

Query time 0.00016