UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lIGaDC3/4/YSE9ird07BlishMaEaQ9Vcv77HYXttWGw=' 
WHERE 
  key_id = 'f530b59e909eade10021e434315b80fb372c7f2057bea2c2715827844d814c4e' 
  AND (
    token = 'lIGaDC3/4/YSE9ird07BlishMaEaQ9Vcv77HYXttWGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016