UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C+DFfbZ8vYCCfpL+ks052sp+uSqzzH2vl9tE7a3m7JI=' 
WHERE 
  key_id = '394b839929dd2f7221398e0e3cfec707f42d6788bf7c92388d6098eaa7053c9d' 
  AND (
    token = 'C+DFfbZ8vYCCfpL+ks052sp+uSqzzH2vl9tE7a3m7JI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044