UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pJLOtWFlCRqvgPPH7vg6Ke11NQ98WxiWZ3LVacMgE+s=' 
WHERE 
  key_id = 'f61c40180eb500b5ee5078927f283efe4dc3c70c18ff8981e28507de6a4f1b10' 
  AND (
    token = 'pJLOtWFlCRqvgPPH7vg6Ke11NQ98WxiWZ3LVacMgE+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021