UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n2HKBhK3KZVRFalk79LBiq4ZsYkheOPx8Lp5MXFQ2LE=' 
WHERE 
  key_id = '3aa22c6195f842055f9ef74c1d588e624617520baceb3bfb50272312099bdf66' 
  AND (
    token = 'n2HKBhK3KZVRFalk79LBiq4ZsYkheOPx8Lp5MXFQ2LE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016