UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XBpcBHs86YmOn2ZIidLiqmABQZscPGS3+NGCZFizjng=' 
WHERE 
  key_id = '61daa8d4909ac4eded3becca4100d5f5bdfdd7486346793f4c190ffe981c20a7' 
  AND (
    token = 'XBpcBHs86YmOn2ZIidLiqmABQZscPGS3+NGCZFizjng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031