UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xa7hTPvpaBaMxHZwaQsuJ/wrJX0D1LNyFNY6RJW1snA=' 
WHERE 
  key_id = 'c1de56f41af15cc1367e3992c1352db791758edb725d207c6c3a6ebaca2c58a6' 
  AND (
    token = 'xa7hTPvpaBaMxHZwaQsuJ/wrJX0D1LNyFNY6RJW1snA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043