UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P/fq0x16AGep9LPqOtEvA8FjNy2M9k3mZQ458wI6Cxs=' 
WHERE 
  key_id = '26d89622564f6e6de5409907dfaef8208e944f685ee9fc4cdea05b952f8aa09b' 
  AND (
    token = 'P/fq0x16AGep9LPqOtEvA8FjNy2M9k3mZQ458wI6Cxs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037