UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gFDaOappBm3nXgekWc2Btbcdt49gBa3mCRacysf5exk=' 
WHERE 
  key_id = '49ff826278bef42c4bdb87d7ac4ade8664b5d9eb9915de74d62087b636fbd983' 
  AND (
    token = 'gFDaOappBm3nXgekWc2Btbcdt49gBa3mCRacysf5exk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028