UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bAPuoJLQLHlNz+A2LVAc5ydD4Uha3oGoRtSi7Y2mPdY=' 
WHERE 
  key_id = 'fceb22176c51b57a74ab420f7c8f43d9e3069c7502e36ee1b08a11f4a3ddb6ad' 
  AND (
    token = 'bAPuoJLQLHlNz+A2LVAc5ydD4Uha3oGoRtSi7Y2mPdY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048