UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gyuye+fISPpXNkptWeEjQtAG8abm02b1qrK63+O4woE=' 
WHERE 
  key_id = 'c29d9dccb65627addb797f85df2fc0882f3a8a9007146d13685f54fa3c4ea0e3' 
  AND (
    token = 'Gyuye+fISPpXNkptWeEjQtAG8abm02b1qrK63+O4woE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027